-
Notifications
You must be signed in to change notification settings - Fork 659
feat(assert/unstable,internal): truncate big diffs #6835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6835 +/- ##
==========================================
- Coverage 94.16% 94.12% -0.05%
==========================================
Files 573 575 +2
Lines 42400 42535 +135
Branches 6732 6767 +35
==========================================
+ Hits 39928 40037 +109
- Misses 2422 2446 +24
- Partials 50 52 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
de26b2d to
f8d9a31
Compare
f8d9a31 to
80cde69
Compare
|
This looks pretty nice. On a somewhat related topic I thought I made an issue suggesting directing the output to a file a while ago, but I can't seem to find it. The point being to allow one to parse the difference in an easier manner than in the terminal. |
@BlackAsLight Is that necessary as part of the API though? Why not just $ NO_COLOR=1 deno eval "import { assertEquals } from 'jsr:@std/assert'; assertEquals(1, 2)" 2> errors.txt
$ cat errors.txt
error: Uncaught (in promise) AssertionError: Values are not equal.
[Diff] Actual / Expected
- 1
+ 2
throw new AssertionError(message);
^
at assertEquals (https://jsr.io/@std/assert/1.0.14/equals.ts:64:9)
at file:///root/source/repos/$deno$eval.mts:1:49 |
I didn't think of that, but that also seems pretty verbose and having it send its contents to a specific file only when it errors seems pretty convenient to me. |
3eaa7d8 to
27fac61
Compare
27fac61 to
7645e70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay in review.
Looks reasonable improvement of diffs. LGTM
Fixes #6631
Default behavior remains unchanged. By setting the opt-in
DIFF_CONTEXT_LENGTHenv var (name subject to bikeshedding), you can enable output like this:Maybe this needs marked
UNSTABLE(unstable version ofedit: probably better to just parameterize stable version and export a customized version from unstable)internal/build-messagewith unstable versions ofassert/equalsandassert/strict-equalsthat are identical apart from doc + dependency change